You are here: Symbol Reference > Dew Namespace > Dew.Stats Namespace > Dew.Stats.Units Namespace > Classes > Statistics Class > Statistics Methods > GammaFit Method > Statistics.GammaFit Method ([In] TVec, out double, out double, double[], double[], int, double, double)
Dew Stats for .NET
ContentsIndexHome
PreviousUpNext
Statistics.GammaFit Method ([In] TVec, out double, out double, double[], double[], int, double, double)

Calculate parameters for Gamma distributed values.

Syntax
C#
Visual Basic
public static void GammaFit([In] TVec X, out double A, out double B, ref double[] PCIA, ref double[] PCIB, int MaxIter, double Tolerance, double Alpha);
Parameters 
Description 
[In] TVec X 
Stores data which is assumed to be Gamma distributed. 
out double A 
Return Gamma distribution parameter estimator A. 
out double B 
Return Gamma distribution parameter estimator B. 
ref double[] PCIA 
A (1-Alpha)*100 percent confidence interval. 
ref double[] PCIB 
B (1-Alpha)*100 percent confidence interval. 
int MaxIter 
Maximum number of iterations needed for deriving a and b. 
double Tolerance 
Defines the acceptable tolerance for calculating a and b. 
double Alpha 
Confidence interval percentage. 

RandomGamma, GammaStat

The following example generates 100 random Gamma distributed values and then uses GammaFit routine to extract used a and b parameters

using Dew.Math; using Dew.Stats; using Dew.Stats.Units; namespace Dew.Examples; { private void Example() { Vector vec1 = new Vector(0); // first, generate 1000 randomly gamma distributed // numbers with parameters a=0.5 and b =1.2 vec1.Size(1000, false); StatRandom.RandomGamma(0.5, 1.2, vec1, -1); // Now extract the a,b and their 95% confidence intervals. // Use at max 400 iterations and tolerance 0.0001 double resA, resB; double[] CIA = new double[2]; double[] CIB = new double[2]; Statistics.GammaFit(vec1, out resA, out resB, out CIA, out CIB, 400, 1e-4, 0.05); } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!